home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Controls
/
Visual Basic Controls.iso
/
vbcontrol
/
cstwnd
/
ncbutton.h
< prev
next >
Wrap
C/C++ Source or Header
|
1993-12-29
|
4KB
|
134 lines
#ifndef _NCBUTTON_H_
#define _NCBUTTON_H_
#ifndef __OWL_H
#include <owl.h>
#endif
_CLASSDEF(TNCButton)
class _EXPORT TNCButton
{
public:
RECT Window;
int Id;
HWND Parent;
int Pos;
char MaintainRB; //Right or Bottom Position
TNCButton(HWND AParent, RECT& AWindow, int AnId);
virtual ~TNCButton();
virtual void SetRight(int APos)
{ Pos = APos; MaintainRB = TRUE; };
virtual void DrawUp(HDC ToDC);
virtual void DrawDown(HDC ToDC);
virtual void Clicked(void);
virtual void PreClicked(void) {};
protected:
int Width, Height, Left, Top;
virtual LPSTR GetClassName(void)
{ return (LPSTR)"NCBUTTON"; };
};
_CLASSDEF(TNCBitButton)
class _EXPORT TNCBitButton : public TNCButton
{
HBITMAP Up, Down;
BITMAP BitObj;
public:
TNCBitButton(HWND AParent, RECT& AWindow, int AnId,
HINSTANCE Inst, LPSTR BitUp, LPSTR BitDown);
~TNCBitButton();
virtual void DrawUp(HDC ToDC);
virtual void DrawDown(HDC ToDC);
protected:
virtual LPSTR GetClassName(void)
{ return (LPSTR)"NCBITBUTTON"; };
};
/*******************************************************************
I have no idea why I export it, everything expands inline.
*******************************************************************/
_CLASSDEF(TNCSystemButton)
class _EXPORT TNCSystemButton : public TNCBitButton
{
public:
TNCSystemButton(HWND AParent, RECT& AWindow, int Type,
HINSTANCE Inst, LPSTR BitUp, LPSTR BitDown)
: TNCBitButton(AParent, AWindow, Type, Inst,
BitUp, BitDown)
{ };
~TNCSystemButton();
virtual void Clicked(void)
{ PostMessage(Parent, WM_SYSCOMMAND, Id, 0l); };
protected:
virtual LPSTR GetClassName(void)
{ return (LPSTR)"NCSYSTEMBUTTON"; };
};
_CLASSDEF(TNCCharButton)
class _EXPORT TNCCharButton : public TNCButton
{
HBITMAP BitUp, BitDown;
HINSTANCE Inst;
char* Char;
public:
TNCCharButton(HWND AParent, RECT& AWindow, int AnId,
HINSTANCE AnInst, char* AChar);
~TNCCharButton();
void SetChar(char* AChar);
virtual void DrawUp(HDC ToDC);
virtual void DrawDown(HDC ToDC);
protected:
virtual LPSTR GetClassName(void)
{ return (LPSTR)"NCCHARBUTTON"; };
};
_CLASSDEF(TNCRadioButton)
class _EXPORT TNCRadioButton : public TNCButton
{
HBITMAP BitMask, BitOn, BitOff;
HINSTANCE Inst;
char Changeable, State;
BITMAP BitObj;
public:
TNCRadioButton(HWND AParent, RECT& AWindow, int AnId,
HINSTANCE AnInst, LPSTR On, LPSTR Off, char Change,
char IState);
~TNCRadioButton();
char GetState(void);
char SetState(char NState);
virtual void DrawUp(HDC ToDC);
virtual void DrawDown(HDC ToDC);
virtual void Clicked(void);
virtual void PreClicked(void);
protected:
virtual LPSTR GetClassName(void)
{ return (LPSTR)"NCRADIOBUTTON"; };
};
//Some defines that make using the above classes a
//little easier
/*******************************************************************
Position from the left of a standard top title bar.
*******************************************************************/
#define AreaFromTopLeft(rct, pos) \
{ rct.left = TitleRect.left + BitWidth * (pos);\
rct.top = TitleRect.top;\
rct.right = TitleRect.left + BitWidth * ((pos)+1);\
rct.bottom = TitleRect.top + BitHeight - 1; };
/*******************************************************************
Position from the right of a standard top title bar.
*******************************************************************/
#define AreaFromTopRight(rct, pos) \
{ rct.left = TitleRect.right - BitWidth * ((pos)+1);\
rct.top = TitleRect.top;\
rct.right = TitleRect.right - BitWidth * (pos);\
rct.bottom = TitleRect.top + BitHeight-1; };
#endif